﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;

namespace PersonaLibrary.Converters
{
	internal sealed class CollapsedConverter : IValueConverter
	{
		public object Convert(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (value is bool)
			{
				if ((bool)value) return System.Windows.Visibility.Visible;
				else
					return System.Windows.Visibility.Collapsed;
			}
			return null;
		}

		public object ConvertBack(object value, System.Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			if (value is System.Windows.Visibility)
			{
				if (((System.Windows.Visibility)value) == System.Windows.Visibility.Visible) return true;
				else return false;
			}
			return null;
		}
	}
}
